How to get DXL return values use java

This is my dxl file:
Folder f = folder "/New Project/New Folder"
Item i
for i in f do
{
if(module(name i)){
print(name i)"\n"
if((name i)=="New Module_01"){
Module m
m = edit("New Module_01",true)
Object o
for o in m do{
print(o."Object Heading")"\n"
}
close(m,true)
}
}

}
and this is java code:
String cmd = "C:\\Program Files\\Telelogic\\DOORS_8.0\\bin\\doors.exe -user Administrator -password 123456 -batch C:\\test.dxl";
Process p = Runtime.getRuntime().exec(cmd);

I donnot know the way to get the return values in java code.
how can I do ?
handleFire - Tue Feb 07 02:08:16 EST 2012

Re: How to get DXL return values use java
Mathias Mamsch - Tue Feb 07 03:22:51 EST 2012

Let me google that for you:

http://www.exampledepot.com/egs/java.lang/ReadFromCommand.html

You will to use the nowait parameter to make DOORS quit immediately without you having to press a button,otherwise you might never get the output. Additionally my experience is, that if you use
 

cout << ...; flush cout

 


instead of print, then your java program will get output immediately while your program is still running. See here:

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14634516&#14634516
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14529729&#14529729

and here for the nowait command line switch:
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14474178&#14474178

Maybe that helps, Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: How to get DXL return values use java
llandale - Tue Feb 07 12:23:27 EST 2012

Forgive if this is stupid, but does not the command interpreter insist the program name be in double quotes because of the space in 'Program Files':
  • C:\\Program Files\\Telelogic\\DOORS_8.0\\bin\\doors.exe
making your code this:
  • String cmd = "\"C:\\Program Files\\Telelogic\\DOORS_8.0\\bin\\doors.exe\" -user Administrator -password 123456 -batch C:\\test.dxl";

Also, the new Windows won't let you put a file in the root C: directory/

-Louie

Re: How to get DXL return values use java
handleFire - Tue Feb 07 20:01:36 EST 2012

Mathias Mamsch - Tue Feb 07 03:22:51 EST 2012

Let me google that for you:

http://www.exampledepot.com/egs/java.lang/ReadFromCommand.html

You will to use the nowait parameter to make DOORS quit immediately without you having to press a button,otherwise you might never get the output. Additionally my experience is, that if you use
 

cout << ...; flush cout

 


instead of print, then your java program will get output immediately while your program is still running. See here:

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14634516&#14634516
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14529729&#14529729

and here for the nowait command line switch:
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14474178&#14474178

Maybe that helps, Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Thanks for your help!!! I will try it.

Re: How to get DXL return values use java
handleFire - Tue Feb 07 20:09:21 EST 2012

llandale - Tue Feb 07 12:23:27 EST 2012
Forgive if this is stupid, but does not the command interpreter insist the program name be in double quotes because of the space in 'Program Files':

  • C:\\Program Files\\Telelogic\\DOORS_8.0\\bin\\doors.exe
making your code this:
  • String cmd = "\"C:\\Program Files\\Telelogic\\DOORS_8.0\\bin\\doors.exe\" -user Administrator -password 123456 -batch C:\\test.dxl";

Also, the new Windows won't let you put a file in the root C: directory/

-Louie

Also,thanks for you recommendation,friend!I will notice that.